{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    nixos-generators = {
      url = "github:nix-community/nixos-generators";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
  outputs = { self, nixpkgs, nixos-generators, ... }: {
    packages.x86_64-linux = {
      qcow2 = nixos-generators.nixosGenerate {
        system = "x86_64-linux";
        modules = [
          ({config, lib, modulesPath, pkgs, ...}: {
              virtualisation.docker.enable = true;

              environment.systemPackages = with pkgs; [
                docker-compose
                bash
                sudo
                coreutils
              ];

              systemd.services.my-docker-compose = {
                  script = ''
                    ${pkgs.coreutils}/bin/chmod -R 0777 /data
                    ${pkgs.docker-compose}/bin/docker-compose -f /data/docker-compose.yml up
                  '';
                  wantedBy = ["multi-user.target"];
                  # If you use podman
                  #after = ["podman.service" "podman.socket"];
                  # If you use docker
                  after = ["docker.service" "docker.socket"];
                  requires = ["docker.service" "docker.socket"];
              };

              system.build.qcow = lib.mkForce (import "${toString modulesPath}/../lib/make-disk-image.nix" {
                inherit lib config pkgs;
                diskSize = 30720;
                format = "qcow2";
                partitionTableType = "hybrid";
                contents = [
                  {source = ./.; target = "/data";}
                ];
              });

              services.openssh = {
                enable = true;

                settings = {
                  # require public key authentication for better security
                  PasswordAuthentication = false;
                  KbdInteractiveAuthentication = false;
                  PermitRootLogin = "yes";
                };
              };

              users.users."root".openssh.authorizedKeys.keyFiles = [
                ./ssh/generated.pub
              ];

              system.stateVersion = "23.11";
          })
        ];
        format = "qcow";


      };
    };
  };
}
